package com.cn.study006;

import java.util.Scanner;

/**
 * @author lw
 * @ClassName Test6006.java
 * @Description
 * @createTime 2023年05月12日 08:35:00
 */
public class Test6006 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入学生姓名：");
        String name = sc.next();
        double score;
        double and = 0;
        for (int i = 1; i <= 5; i++) {
            System.out.print("请输入5门功课中第" + i + "门课的成绩：");
            score = sc.nextDouble();
            if (score<0){
                System.out.println("抱歉，分数录入错误，请重新进行录入");
                break;
            }else{
                and += score;
            }
            if (i==5){
                double avg = and / 5;
                System.out.println(name + "的平均分是：" + avg);
            }
        }
    }
}
